package com.hns.can.common.service;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hns.can.base.entity.TmpOrganStorageEntity;
import com.hns.frame.service.CommonService;

@Service
public class LeftTreeService extends CommonService{
	
	private final Logger logger = LoggerFactory.getLogger(LeftTreeService.class); 
	
	/**
	 * @author：wucx
	 * @description：插入临时表
	 * @param organStorageEntitys
	 * @date：2014年7月6日 上午11:23:00
	 */
	@Transactional
	public void savaTmpOrganStorageList(List<TmpOrganStorageEntity> organStorageEntitys){
		long beginTime = System.currentTimeMillis();
		for (int i = 0; i < organStorageEntitys.size(); i++) {
			TmpOrganStorageEntity entity = organStorageEntitys.get(i);
			commonEntityDao.save(entity);
			if(i % 100 == 0){
				commonEntityDao.flush();
			}
		}
		commonEntityDao.flush();
		
		long endTime = System.currentTimeMillis();
		logger.error("插入临时表用时：" + (endTime-beginTime) + "毫秒！");
	}
}
